import {PrismaClient} from "@/generated/prisma";

declare global {
    var prisma: PrismaClient;
}


export const db = globalThis.prisma || new PrismaClient();

// nextjs hot reload 将会创建多个primsa实例。
if (process.env.NODE_ENV === 'development') globalThis.prisma = db;
